package com.bf.electroplating.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.dto.function.ModuleDTO;
import com.bf.electroplating.pojo.vo.PageVO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.function.ModuleVO;
import com.bf.electroplating.service.PubSystemModuleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * (菜单表)PUB_SYSTEM_MODULE 前端控制器
 * </p>
 *
 * @author xxx
 * @since 2024-10-18
 */
@RestController
@RequestMapping("/pub-system-module")
@Tag(name = "菜单管理", description = "菜单管理")
public class PubSystemModuleController {

    @Resource
    private PubSystemModuleService moduleService;

    @GetMapping("/getMenu")
    @Operation(summary = "获取菜单", description = "获取菜单")
    public ResultVO<List<ModuleVO>> getMenu() {
        return moduleService.getMenu();
    }

    @GetMapping("/getSelectList")
    @Operation(summary = "获取下拉", description = "获取下拉")
    public ResultVO<List<ModuleVO>> getSelectList() {
        return moduleService.getSelectList();
    }

    @PostMapping("/getPage")
    @Operation(summary = "获取分页", description = "获取分页")
    public ResultVO<Page<ModuleVO>> getPage(@RequestBody PageVO dto) {
        return moduleService.getPage(dto);
    }

    @PostMapping("/saveOrUpdate")
    @Operation(summary = "保存或修改", description = "保存或修改")
    public ResultVO<Object> saveOrUpdate(@RequestBody ModuleDTO dto) {
        return moduleService.updateOrSave(dto);
    }

    @PostMapping("/delete")
    @Operation(summary = "删除", description = "删除")
    public ResultVO<Object> delete(@RequestBody IdDTO dto) {
        return moduleService.delete(dto);
    }

    @PostMapping("/getDetail")
    @Operation(summary = "获取详情", description = "获取详情")
    public ResultVO<ModuleDTO> getDetail(@RequestBody IdDTO dto) {
        return moduleService.getDetail(dto);
    }

}
